<?php
include("conn.php");
include("head.php");
$textarea=htmtocode($_POST[textarea]);
$title=$_POST[title];
$id=$_POST[id];



//$regex = '/[^\.^x00-xff]*\.?/';
$regex = '/[^\.]*\pP/';
$str = $textarea;
$matches = array();

$sql="INSERT INTO  `db_design`.`article` (
`ar_id` ,
`ar_title` ,
`ar_writer` ,
`content`
)
VALUES (
'$id',  '$title',  'who',  '$str'
);";
mysql_query($sql);
 
if(preg_match_all($regex, $str, $matches)){
    print_r($matches);
}


echo "<br><br>";
echo "result:";
for( $i=0; $i<count($matches[0]); $i++){
echo "<br>";
$ii=$i+1;
$ss=$matches[0][$i];
echo $matches[0][$i];	
$sql="INSERT INTO  `db_design`.`sentence` (
`sen_id` ,
`ar_id` ,
`num_in_ar` ,
`selected` ,
`content`
)
VALUES (
'11',  '$id',  '$ii',  '0',  '$ss'
);";
mysql_query($sql);


}








?>